jsx3.Class.defineClass(
        "tibco.admin.monitormanage.uicomponents.page.deployment.Deployment", //the full name of the class to create
        jsx3.lang.Object, //  extends
        [tibco.admin.monitormanage.framework.mainPage.MainPageInterface,tibco.admin.plugin.PluginContainerInterface], // implements
        function (plugin) {
        
        	plugin.wsEndpointURL = tibco.admin.monitormanage.framework.mainPage.MainPage.wsEndpointURL;
        
        	plugin.environmentScreenId = "tibco.admin.monitormanage.uicomponents.page.deployment.Deployment.environmentScreen";
        	plugin.serviceAssemblyScreenId = "tibco.admin.monitormanage.uicomponents.page.deployment.Deployment.serviceAssemblyScreen";
        	plugin.serviceUnitScreenId = "tibco.admin.monitormanage.uicomponents.page.deployment.Deployment.serviceUnitScreen";
        	
        	plugin.serviceAssemblyInfoCacheSubject = "tibco.admin.monitormanage.uicomponents.page.deployment.Deployment.serviceAssemblyInfoCache";
        	plugin.serviceUnitInfoCacheSubject = "tibco.admin.monitormanage.uicomponents.page.deployment.Deployment.serviceUnitInfoCache";
        	plugin.serviceAssemblyPerformRefreshSubject = "tibco.admin.monitormanage.uicomponents.page.deployment.Deployment.serviceAssemblyPerformRefreshSubject";
        	
        	plugin.serviceAssemblyInfoCacheId = "SPM_SERVICE_ASSEMBLY_SCREEN_CACHE";
        	plugin.serviceUnitInfoCacheId = "SPM_SERVICE_UNIT_SCREEN_CACHE";
        	plugin.serviceUnitNodesCacheId = "SPM_SERVICE_UNIT_NODES_CACHE";
        	
            plugin.instance = null;
            
            plugin.prototype.allTabs = new Object();
            plugin.prototype.tabsToLoad = new Object();
            
            plugin.prototype.envScreen = null;
            plugin.prototype.serviceAssemblyScreen = null;
            plugin.prototype.serviceUnitScreen = null;
            plugin.prototype.currentlyDisplayedScreen = null;
            
            plugin.prototype.loadingEnvironmentPlugins = false;
            plugin.prototype.loadingServiceAssemblyPlugins = false;
            plugin.prototype.loadingServiceUnitPlugins = false;
            
            plugin.prototype.serviceAssemblyId;
            plugin.prototype.serviceUnitId;
            
            plugin.prototype.pluginsLoaded = false;
            plugin.prototype.displayScreenWaiting = false;
		    plugin.prototype.screenIdWaiting;
		    plugin.prototype.parameterArrayWaiting;
		    
		    plugin.prototype.environmentComponentsHidden = null;
		    
		    plugin.prototype.serviceUnitTabKeys;
		    plugin.prototype.serviceUnitTabObjs;

            plugin.getInstance = function(args) {
                if(!this.instance) {
                    this.instance = new tibco.admin.monitormanage.uicomponents.page.deployment.Deployment();
                }
                return this.instance;
            }

            plugin.prototype.getNamespace = function() {
               return "tibco.admin";
            }

            plugin.prototype.getComponentPath = function() {
                return  "tibco/admin/monitormanage/uicomponents/page/deployment/component.xml"
            }

            plugin.prototype.getTabText = function() {
				return tibco.admin.Main.getServer().getDynamicProperty("@MM@general@DeploymentViewTitle");
            	//return "Deployment View";
            }

            plugin.prototype.loadComponent = function(parent) {
            	this.allTabs = new Object();
	            this.tabsToLoad = new Object();
	            this.envScreen = null;
	            this.serviceAssemblyScreen = null;
	            this.serviceUnitScreen = null;
	            this.currentlyDisplayedScreen = null;
	            this.loadingEnvironmentPlugins = false;
	            this.loadingServiceAssemblyPlugins = false;
	            this.loadingServiceUnitPlugins = false;
	            this.serviceAssemblyId = null;
	            this.serviceUnitId = null;
	            this.pluginsLoaded = false;
	            this.displayScreenWaiting = false;
			    this.screenIdWaiting = null;
			    this.parameterArrayWaiting = null;
			    this.environmentComponentsHidden = null;
			    this.serviceUnitTabKeys = new jsx3.util.List();
			    this.serviceUnitTabObjs = new jsx3.util.List();
           
                this.block = tibco.admin.Main.loadUIResource(parent, this.getNamespace(), "tibco/admin/monitormanage/uicomponents/page/deployment/components/deployment.xml", true);
				tibco.admin.Main.loadResource("tibco/admin/monitormanage/uicomponents/page/deployment/jss/deploymentJSS.xml", this.getNamespace(), "SPM_DEPLOYMENT_JSS_CACHE", "jss", true);
				tibco.admin.Main.loadResource("tibco/admin/monitormanage/uicomponents/page/deployment/jss/deploymentTextJSS.xml", this.getNamespace(), "SPM_DEPLOYMENT_TEXT_JSS_CACHE", "ljss", true);
                
                this.envScreen = new jsx3.gui.Block("envScreen", 0, 0, "100%", "100%");
                this.block.setChild(this.envScreen);
                this.currentlyDisplayedScreen = this.envScreen;
            }
            
            plugin.prototype.setupPlugin = function(obj) {
            }
            
            plugin.prototype.onAfterGetPlugins = function() {
            	if(this.loadingEnvironmentPlugins)
            	{
            		this.loadingEnvironmentPlugins = false;
            		var headerPaneName = "environmentHeaderPluginPane";
                	var headerClassName = "tibco.admin.monitormanage.uicomponents.page.deployment.EnvironmentHeaderInterface";
                	var tabClassName = "tibco.admin.monitormanage.uicomponents.page.deployment.EnvironmentTabInterface";
                	this.handleExtensionPoints(headerPaneName, headerClassName, tabClassName, "environment", "environmentContentBlock");
            	}
            	else if(this.loadingServiceAssemblyPlugins)
            	{
            		this.loadingServiceAssemblyPlugins = false;
            		var headerPaneName = "serviceAssemblyHeaderPluginPane";
                	var headerClassName = "tibco.admin.monitormanage.uicomponents.page.deployment.ServiceAssemblyHeaderInterface";
                	var tabClassName = "tibco.admin.monitormanage.uicomponents.page.deployment.ServiceAssemblyTabInterface";
                	this.handleExtensionPoints(headerPaneName, headerClassName, tabClassName, "serviceAssembly", "serviceAssemblyContentBlock");
            	}
            	else if(this.loadingServiceUnitPlugins)
            	{
            		this.loadingServiceUnitPlugins = false;
            		var headerPaneName = "serviceUnitHeaderPluginPane";
                	var headerClassName = "tibco.admin.monitormanage.uicomponents.page.deployment.ServiceUnitHeaderInterface";
                	var tabClassName = "tibco.admin.monitormanage.uicomponents.page.deployment.ServiceUnitTabInterface";
                	this.handleExtensionPoints(headerPaneName, headerClassName, tabClassName, "serviceUnit", "serviceUnitContentPane");
                }
                
                // now check to see if the displayScreen call is waiting for the loaded plugins
				this.pluginsLoaded = true;
				if(this.displayScreenWaiting)
				{ 
					this.displayScreenWaiting = false;
					this.displayScreen(this.screenIdWaiting, this.parameterArrayWaiting); 
				}
            }
            
            plugin.prototype.handleExtensionPoints = function(headerPaneName, headerClassName, tabClassName, tabPrefix, tabContentBlockName, idToPass) {
               	var headerPane = this.block.getDescendantOfName(headerPaneName);
               	var iter = this.getPluginList().iterator();
               	var tabPluginList = new jsx3.util.List();
               	while(iter.hasNext()) {
               	    var obj = iter.next();
               	    if(jsx3.Class.forName(headerClassName).isInstance(obj))
               	    {
               	    	// construct the parent block for the plugin component
               			var parentBlock = new jsx3.gui.Block("pluginParentBlock", 0, 0, obj.getPluginComponentWidth(), "100%");
               			parentBlock.setCSSOverride("float:left");
               			headerPane.setChild(parentBlock);
	               	    obj.loadComponent(parentBlock, idToPass);
            		}
            		else if(jsx3.Class.forName(tabClassName).isInstance(obj))
            		{ tabPluginList.add(obj); }
               	}
               	headerPane.repaint();
               	
               	// handle the tab plugin components
                if(tabPluginList.size() > 0)
                {
                	var contentBlock = this.block.getDescendantOfName(tabContentBlockName);
                	if(tabPluginList.size() == 1)
                	{ 
                		// if there is only one tab component then don't display the tabs
                		tabPluginList.get(0).loadComponent(contentBlock, idToPass); 
                		contentBlock.repaint();
                	}
                	else
                	{
	                	var tabpane = new com.gix.gui.TabbedPane(tabPrefix+"TabbedPane", null, null, "100%", "100%");
	                	contentBlock.setChild(tabpane);
	                	var iter = tabPluginList.iterator();
	                	var first = true;
                		while(iter.hasNext()) 
                		{
                	    	var obj = iter.next();
                	    	var tabId = tabPrefix + "_tab_" + obj.getTabText();
                	    	this.allTabs[tabId] = obj;
                	    	var tab = new com.gix.gui.Tab(tabId, null, null, null, obj.getTabText());
                	    	tab.subscribe(jsx3.gui.Interactive.EXECUTE,this,this.loadTab);
                	    	tabpane.setChild(tab);
                	    	this.serviceUnitTabKeys.add(tabId);
                	    	this.serviceUnitTabObjs.add(tab);
                	    	if(first) {
                	    	    obj.loadComponent(tab.getContentPane(), idToPass);
                	    	    first = false;
                	    	}
                	    	else {
                	    	    this.tabsToLoad[tabId] = obj;
                	    	}
                	    }
                	    contentBlock.repaint();
                	}
                }
            }
            
            plugin.prototype.loadTab = function(objEvent) {
               var tabObj = objEvent.target;
               var tabIdPrefix = "serviceUnit";
               if(tabObj.getAncestorOfName("envScreen"))
               { tabIdPrefix = "environment"; }
               else if(tabObj.getAncestorOfName("serviceAssemblyScreen"))
               { tabIdPrefix = "serviceAssembly"; }
               var tabId = tabIdPrefix + '_tab_' + tabObj.getText();
                if(this.tabsToLoad[tabId]) {
                    var obj = this.tabsToLoad[tabId];
                    if(obj) {
                        obj.loadComponent(objEvent.target.getContentPane());
                        delete this.tabsToLoad[tabId];
                    }
                }
                this.allTabs[tabId].tabClicked();
            }
			
			plugin.prototype.getDefaultScreenId = function() {
        		return plugin.environmentScreenId;
        	}
            
            plugin.prototype.getScreenIds = function() {
            	return [plugin.environmentScreenId,plugin.serviceAssemblyScreenId, plugin.serviceUnitScreenId];
        	}
        	
        	plugin.prototype.buildScreen = function(screenId, parameterArray) {
			var parentBlock;
        		if(screenId == plugin.environmentScreenId)
        		{
        			tibco.admin.Main.loadUIResource(this.envScreen, this.getNamespace(), "tibco/admin/monitormanage/uicomponents/page/deployment/components/environment.xml", true);
            	
	            	var envPane = this.envScreen.getDescendantOfName("environmentPane");
			parentBlock = this.envScreen;
	                if(!tibco.admin.monitormanage || !tibco.admin.monitormanage.uicomponents || !tibco.admin.monitormanage.uicomponents.dropdown || !tibco.admin.monitormanage.uicomponents.dropdown.environment || !tibco.admin.monitormanage.uicomponents.dropdown.environment.Environment)
	                { tibco.admin.Main.loadClass("tibco/admin/monitormanage/uicomponents/dropdown/environment/Environment.js", this.getNamespace()); }
	                var envDropdown = tibco.admin.Main.loadUIResource(envPane, this.getNamespace(), "tibco/admin/monitormanage/uicomponents/dropdown/environment/components/environment.xml", true);
					var environmentLabel = envDropdown.getDescendantOfName("environmentLabel");
					environmentLabel.setDisplay(jsx3.gui.Block.DISPLAYNONE,true);
					var envId = null;
					if(parameterArray)
					{ envId = parameterArray.environmentId; }
        			tibco.admin.monitormanage.general.PageBusUtils.subscribe(tibco.admin.monitormanage.uicomponents.dropdown.environment.Environment.environmentHideComponentsSubject, this.handleEnvironmentHideComponents, this);
					envDropdown.setUpComponent(false, plugin.environmentScreenId, "_MM_dply", envId);
					tibco.admin.monitormanage.general.PollingHandler.register(tibco.admin.monitormanage.general.PollingHandler.GENERAL_POLLING_HANDLER_ID, envDropdown, envDropdown.updateComponent, plugin.environmentScreenId);
					tibco.admin.monitormanage.general.RefreshHandler.register(envDropdown, envDropdown.updateComponent, plugin.environmentScreenId);
	
	                var headerPane = this.envScreen.getDescendantOfName("environmentHeaderPane");
	               	if(!tibco.admin.monitormanage || !tibco.admin.monitormanage.uicomponents || !tibco.admin.monitormanage.uicomponents.text || !tibco.admin.monitormanage.uicomponents.text.environmentHeader || !tibco.admin.monitormanage.uicomponents.text.environmentHeader.EnvironmentHeader)
	               	{ tibco.admin.Main.loadClass("tibco/admin/monitormanage/uicomponents/text/environmentHeader/environmentHeader.js", this.getNamespace()); }
	               	var headerObj = tibco.admin.Main.loadUIResource(headerPane, this.getNamespace(), "tibco/admin/monitormanage/uicomponents/text/environmentHeader/components/environmentHeader.xml", true);
	               	headerObj.setUpComponent(plugin.environmentScreenId);
	                   
	                // load the plugins
					var interfaceList = this.getInterfaceList();
					var preloadList = this.getPreloadList();
					this.loadingEnvironmentPlugins = true;
					this.loadPlugins(interfaceList, preloadList);
        		}
        		else if(screenId == plugin.serviceAssemblyScreenId)
        		{
        			// load the service assembly screen
        			
        			tibco.admin.monitormanage.general.PollingHandler.register(tibco.admin.monitormanage.general.PollingHandler.GENERAL_POLLING_HANDLER_ID, this, this.updateComponent, plugin.serviceAssemblyScreenId);
        			tibco.admin.monitormanage.general.RefreshHandler.register(this, this.updateComponent, plugin.serviceAssemblyScreenId);
        			tibco.admin.monitormanage.general.PageBusUtils.subscribe(plugin.serviceAssemblyPerformRefreshSubject, this.refreshServiceAssemblyCache, this);
        			
        			this.serviceAssemblyScreen = new jsx3.gui.Block("serviceAssemblyScreen", 0, 0, "100%", "100%");
				parentBlock = this.serviceAssemblyScreen;
        			this.block.setChild(this.serviceAssemblyScreen);
        			var serviceAssemblyBlock = tibco.admin.Main.loadUIResource(this.serviceAssemblyScreen, this.getNamespace(), "tibco/admin/monitormanage/uicomponents/page/deployment/components/serviceAssembly.xml", true);
        			
        			var breadcrumbPane = serviceAssemblyBlock.getDescendantOfName("breadcrumbPane");
                	if(!tibco.admin.monitormanage || !tibco.admin.monitormanage.uicomponents || !tibco.admin.monitormanage.uicomponents.misc || !tibco.admin.monitormanage.uicomponents.misc.breadcrumb || !tibco.admin.monitormanage.uicomponents.misc.breadcrumb.Breadcrumb)
                	{ tibco.admin.Main.loadClass("tibco/admin/monitormanage/uicomponents/misc/breadcrumb/Breadcrumb.js", this.getNamespace()); }
                	var bc = tibco.admin.Main.loadUIResource(breadcrumbPane, this.getNamespace(), "tibco/admin/monitormanage/uicomponents/misc/breadcrumb/components/breadcrumb.xml", true);
                	bc.setUpComponent("_MM_dply", true, tibco.admin.monitormanage.uicomponents.misc.breadcrumb.Breadcrumb.displayTypeServiceAssembly, plugin.serviceAssemblyInfoCacheSubject, plugin.serviceAssemblyInfoCacheId);
                	
                	var serviceAssemblyHeaderPane = serviceAssemblyBlock.getDescendantOfName("serviceAssemblyHeaderPane");
        			if(!tibco.admin.monitormanage || !tibco.admin.monitormanage.uicomponents || !tibco.admin.monitormanage.uicomponents.text || !tibco.admin.monitormanage.uicomponents.text.serviceAssemblyHeader || !tibco.admin.monitormanage.uicomponents.text.serviceAssemblyHeader.ServiceAssemblyHeader)
                	{ tibco.admin.Main.loadClass("tibco/admin/monitormanage/uicomponents/text/serviceAssemblyHeader/ServiceAssemblyHeader.js", this.getNamespace()); }
                	var headerPane = tibco.admin.Main.loadUIResource(serviceAssemblyHeaderPane, this.getNamespace(), "tibco/admin/monitormanage/uicomponents/text/serviceAssemblyHeader/components/serviceAssemblyHeader.xml", true);
                	headerPane.setUpComponent();

                	this.serviceAssemblyId = parameterArray.serviceAssemblyId;
                	
					// load the plugins
					var interfaceList = this.getInterfaceList();
					var preloadList = this.getPreloadList();
					this.loadingServiceAssemblyPlugins = true;
					this.loadPlugins(interfaceList, preloadList);
        		}
        		else if(screenId == plugin.serviceUnitScreenId)
        		{
        			// load the service unit screen
        			tibco.admin.monitormanage.general.PollingHandler.register(tibco.admin.monitormanage.general.PollingHandler.GENERAL_POLLING_HANDLER_ID, this, this.updateComponent, plugin.serviceUnitScreenId);
			        tibco.admin.monitormanage.general.RefreshHandler.register(this, this.updateComponent, plugin.serviceUnitScreenId);
        			
        			this.serviceUnitScreen = new jsx3.gui.Block("serviceUnitScreen", 0, 0, "100%", "100%");
				parentBlock = this.serviceUnitScreen;
        			this.block.setChild(this.serviceUnitScreen);
        			var serviceUnitBlock = tibco.admin.Main.loadUIResource(this.serviceUnitScreen, this.getNamespace(), "tibco/admin/monitormanage/uicomponents/page/deployment/components/serviceUnit.xml", true);
        			
        			var breadcrumbPane = serviceUnitBlock.getDescendantOfName("breadcrumbPane");
                	if(!tibco.admin.monitormanage || !tibco.admin.monitormanage.uicomponents || !tibco.admin.monitormanage.uicomponents.misc || !tibco.admin.monitormanage.uicomponents.misc.breadcrumb || !tibco.admin.monitormanage.uicomponents.misc.breadcrumb.Breadcrumb)
                	{ tibco.admin.Main.loadClass("tibco/admin/monitormanage/uicomponents/misc/breadcrumb/Breadcrumb.js", this.getNamespace()); }
                	var bc = tibco.admin.Main.loadUIResource(breadcrumbPane, this.getNamespace(), "tibco/admin/monitormanage/uicomponents/misc/breadcrumb/components/breadcrumb.xml", true);
                	bc.setUpComponent("_MM_dply", true, tibco.admin.monitormanage.uicomponents.misc.breadcrumb.Breadcrumb.displayTypeServiceUnit, plugin.serviceUnitInfoCacheSubject, plugin.serviceUnitInfoCacheId);
        			
        			
                	
                	var serviceUnitHeaderPane = serviceUnitBlock.getDescendantOfName("serviceUnitHeaderPane");
        			if(!tibco.admin.monitormanage || !tibco.admin.monitormanage.uicomponents || !tibco.admin.monitormanage.uicomponents.text || !tibco.admin.monitormanage.uicomponents.text.serviceUnitHeader || !tibco.admin.monitormanage.uicomponents.text.serviceUnitHeader.ServiceUnitHeader)
                	{ tibco.admin.Main.loadClass("tibco/admin/monitormanage/uicomponents/text/serviceUnitHeader/ServiceUnitHeader.js", this.getNamespace()); }
                	var serviceUnitHeaderObj = tibco.admin.Main.loadUIResource(serviceUnitHeaderPane, this.getNamespace(), "tibco/admin/monitormanage/uicomponents/text/serviceUnitHeader/components/serviceUnitHeader.xml", true);
                	serviceUnitHeaderObj.setUpComponent();
                	
                	this.serviceUnitId = parameterArray.serviceUnitId;
                	
                	// handle the plugin components
                	var interfaceList = this.getInterfaceList();
                    var preloadList = this.getPreloadList();
                    this.loadingServiceUnitPlugins = true;
                    this.loadPlugins(interfaceList, preloadList);
                }
		var timeframePane = parentBlock.getDescendantOfName("timeframePane");
		if(!tibco.admin.monitormanage || !tibco.admin.monitormanage.uicomponents || !tibco.admin.monitormanage.uicomponents.dropdown || !tibco.admin.monitormanage.uicomponents.dropdown.timeframe || !tibco.admin.monitormanage.uicomponents.dropdown.timeframe.Timeframe)
		{ tibco.admin.Main.loadClass("tibco/admin/monitormanage/uicomponents/dropdown/timeframe/Timeframe.js", this.getNamespace()); }
		var timeframeDropdown = tibco.admin.Main.loadUIResource(timeframePane, this.getNamespace(), "tibco/admin/monitormanage/uicomponents/dropdown/timeframe/components/timeframe.xml", true);
		timeframeDropdown.setUpComponent("_MM_dply", false, screenId);
        	}
        	
        	plugin.prototype.getPreloadList = function() {
        		// preload the tabs
                if(!tibco.admin.monitormanage || !tibco.admin.monitormanage.uicomponents || !tibco.admin.monitormanage.uicomponents.page || !tibco.admin.monitormanage.uicomponents.page.deployment || !tibco.admin.monitormanage.uicomponents.page.deployment.tabContent || !tibco.admin.monitormanage.uicomponents.page.deployment.tabContent.serviceAssemblies || !tibco.admin.monitormanage.uicomponents.page.deployment.tabContent.serviceAssemblies.ServiceAssemblies)
                { tibco.admin.Main.loadClass("tibco/admin/monitormanage/uicomponents/page/deployment/tabContent/serviceAssemblies/ServiceAssemblies.js", this.getNamespace()); }
                if(!tibco.admin.monitormanage || !tibco.admin.monitormanage.uicomponents || !tibco.admin.monitormanage.uicomponents.page || !tibco.admin.monitormanage.uicomponents.page.deployment || !tibco.admin.monitormanage.uicomponents.page.deployment.tabContent || !tibco.admin.monitormanage.uicomponents.page.deployment.tabContent.serviceAssemblyOverview || !tibco.admin.monitormanage.uicomponents.page.deployment.tabContent.serviceAssemblyOverview.ServiceAssemblyOverview)
                { tibco.admin.Main.loadClass("tibco/admin/monitormanage/uicomponents/page/deployment/tabContent/serviceAssemblyOverview/ServiceAssemblyOverview.js", this.getNamespace()); }
                if(!tibco.admin.monitormanage || !tibco.admin.monitormanage.uicomponents || !tibco.admin.monitormanage.uicomponents.page || !tibco.admin.monitormanage.uicomponents.page.deployment || !tibco.admin.monitormanage.uicomponents.page.deployment.tabContent || !tibco.admin.monitormanage.uicomponents.page.deployment.tabContent.overview || !tibco.admin.monitormanage.uicomponents.page.deployment.tabContent.overview.Overview)
                { tibco.admin.Main.loadClass("tibco/admin/monitormanage/uicomponents/page/deployment/tabContent/overview/Overview.js", this.getNamespace()); }
                if(!tibco.admin.monitormanage || !tibco.admin.monitormanage.uicomponents || !tibco.admin.monitormanage.uicomponents.page || !tibco.admin.monitormanage.uicomponents.page.deployment || !tibco.admin.monitormanage.uicomponents.page.deployment.tabContent || !tibco.admin.monitormanage.uicomponents.page.deployment.tabContent.services || !tibco.admin.monitormanage.uicomponents.page.deployment.tabContent.services.Services)
                { tibco.admin.Main.loadClass("tibco/admin/monitormanage/uicomponents/page/deployment/tabContent/services/Services.js", this.getNamespace()); }
                    
                var preloadList = new jsx3.util.List();
                preloadList.add(tibco.admin.monitormanage.uicomponents.page.deployment.tabContent.serviceAssemblies.ServiceAssemblies);
                preloadList.add(tibco.admin.monitormanage.uicomponents.page.deployment.tabContent.serviceAssemblyOverview.ServiceAssemblyOverview);
                preloadList.add(tibco.admin.monitormanage.uicomponents.page.deployment.tabContent.overview.Overview);
                preloadList.add(tibco.admin.monitormanage.uicomponents.page.deployment.tabContent.services.Services);
                return preloadList;
        	}
        	
        	plugin.prototype.getInterfaceList = function() {
        		if(!tibco.admin.monitormanage || !tibco.admin.monitormanage.uicomponents || !tibco.admin.monitormanage.uicomponents.page || !tibco.admin.monitormanage.uicomponents.page.deployment || !tibco.admin.monitormanage.uicomponents.page.deployment.EnvironmentHeaderInterface)
                { tibco.admin.Main.loadClass("tibco/admin/monitormanage/uicomponents/page/deployment/EnvironmentHeaderInterface.js", this.getNamespace()); }
                if(!tibco.admin.monitormanage || !tibco.admin.monitormanage.uicomponents || !tibco.admin.monitormanage.uicomponents.page || !tibco.admin.monitormanage.uicomponents.page.deployment || !tibco.admin.monitormanage.uicomponents.page.deployment.EnvironmentTabInterface)
                { tibco.admin.Main.loadClass("tibco/admin/monitormanage/uicomponents/page/deployment/EnvironmentTabInterface.js", this.getNamespace()); }
                if(!tibco.admin.monitormanage || !tibco.admin.monitormanage.uicomponents || !tibco.admin.monitormanage.uicomponents.page || !tibco.admin.monitormanage.uicomponents.page.deployment || !tibco.admin.monitormanage.uicomponents.page.deployment.ServiceUnitHeaderInterface)
                { tibco.admin.Main.loadClass("tibco/admin/monitormanage/uicomponents/page/deployment/ServiceUnitHeaderInterface.js", this.getNamespace()); }
        		if(!tibco.admin.monitormanage || !tibco.admin.monitormanage.uicomponents || !tibco.admin.monitormanage.uicomponents.page || !tibco.admin.monitormanage.uicomponents.page.deployment || !tibco.admin.monitormanage.uicomponents.page.deployment.ServiceUnitTabInterface)
                { tibco.admin.Main.loadClass("tibco/admin/monitormanage/uicomponents/page/deployment/ServiceUnitTabInterface.js", this.getNamespace()); }
                if(!tibco.admin.monitormanage || !tibco.admin.monitormanage.uicomponents || !tibco.admin.monitormanage.uicomponents.page || !tibco.admin.monitormanage.uicomponents.page.deployment || !tibco.admin.monitormanage.uicomponents.page.deployment.ServiceAssemblyHeaderInterface)
				{ tibco.admin.Main.loadClass("tibco/admin/monitormanage/uicomponents/page/deployment/ServiceAssemblyHeaderInterface.js", this.getNamespace()); }
                if(!tibco.admin.monitormanage || !tibco.admin.monitormanage.uicomponents || !tibco.admin.monitormanage.uicomponents.page || !tibco.admin.monitormanage.uicomponents.page.deployment || !tibco.admin.monitormanage.uicomponents.page.deployment.ServiceAssemblyTabInterface)
				{ tibco.admin.Main.loadClass("tibco/admin/monitormanage/uicomponents/page/deployment/ServiceAssemblyTabInterface.js", this.getNamespace()); }
                
                var interfaceList = new jsx3.util.List();
                interfaceList.add("tibco.admin.monitormanage.uicomponents.page.deployment.ServiceUnitTabInterface");
                interfaceList.add("tibco.admin.monitormanage.uicomponents.page.deployment.ServiceUnitHeaderInterface");
                interfaceList.add("tibco.admin.monitormanage.uicomponents.page.deployment.ServiceAssemblyHeaderInterface");
                interfaceList.add("tibco.admin.monitormanage.uicomponents.page.deployment.ServiceAssemblyTabInterface");
                interfaceList.add("tibco.admin.monitormanage.uicomponents.page.deployment.EnvironmentHeaderInterface");
                interfaceList.add("tibco.admin.monitormanage.uicomponents.page.deployment.EnvironmentTabInterface");
                return interfaceList;
        	}
        	
        	plugin.prototype.handleEnvironmentHideComponents = function(subject, message, deploymentObj) {
        		if(deploymentObj.currentlyDisplayedScreen == deploymentObj.envScreen)
        		{
        			if(deploymentObj.environmentComponentsHidden == null || deploymentObj.environmentComponentsHidden != message.environmentHideComponents)
        			{
	        			var displayStyle;
	        			var instruxDisplayStyle;
	        			if(message.environmentHideComponents)
	        			{ 
	        				displayStyle = jsx3.gui.Block.DISPLAYNONE; 
	        				instruxDisplayStyle = jsx3.gui.Block.DISPLAYBLOCK;
	        				deploymentObj.environmentComponentsHidden = true;
	        			}
	        			else
	        			{
	        				displayStyle = jsx3.gui.Block.DISPLAYBLOCK;
	        				instruxDisplayStyle = jsx3.gui.Block.DISPLAYNONE; 
	        				deploymentObj.environmentComponentsHidden = false;
	        			}
	        			
	        			var headerBlock = deploymentObj.envScreen.getDescendantOfName("secondPane");
	        			if(headerBlock.getDisplay() != displayStyle)
	        			{ headerBlock.setDisplay(displayStyle, true); }
	        			
	        			var contentBlock = deploymentObj.envScreen.getDescendantOfName("environmentContentBlock");
						var dplyMainLayout = deploymentObj.envScreen.getDescendantOfName("dplyMainLayout");
						
	        			if(contentBlock.getDisplay() != displayStyle) {
							contentBlock.setDisplay(displayStyle, true); 
						}
	        			
					var instruxBlock = deploymentObj.envScreen.getDescendantOfName("instructionPane");
	        			if(instruxBlock.getDisplay() != instruxDisplayStyle)
	        			{ instruxBlock.setDisplay(instruxDisplayStyle, true); }
        			}
        		}
        	}
        	
        	plugin.prototype.updateComponent = function() {
        		if(this.currentlyDisplayedScreen == this.serviceAssemblyScreen)
				{ this.callGetServiceAssemblies(); }
				else if(this.currentlyDisplayedScreen == this.serviceUnitScreen)
				{ this.callGetServiceUnits(false); }
			}
        
        	plugin.prototype.displayScreen = function(screenIdVal, parameterArray) {
        		if(this.pluginsLoaded)
        		{
	        		this.currentlyDisplayedScreen.setDisplay(jsx3.gui.Block.DISPLAYNONE);
	        		
	        		var idForPluginClass;
	        		var message = {screenId:screenIdVal};
	        		var tabClassName;
	        		var headerClassName;
	        		var iter = this.getPluginList().iterator();
	        		var isServiceUnitScreen = false;
					if(screenIdVal == plugin.serviceAssemblyScreenId)
					{
						idForPluginClass = parameterArray.serviceAssemblyId;
						tabClassName = "tibco.admin.monitormanage.uicomponents.page.deployment.ServiceAssemblyTabInterface";
						headerClassName = "tibco.admin.monitormanage.uicomponents.page.deployment.ServiceAssemblyHeaderInterface";
						message.serviceAssemblyId = parameterArray.serviceAssemblyId;
						this.serviceAssemblyId = parameterArray.serviceAssemblyId;
						this.currentlyDisplayedScreen = this.serviceAssemblyScreen;
						this.callGetServiceAssemblies(); 					
					}
					else if(screenIdVal == plugin.serviceUnitScreenId)
					{
						isServiceUnitScreen = true;
						message.serviceUnitId = parameterArray.serviceUnitId;
//						idForPluginClass = parameterArray.serviceUnitId;
//						tabClassName = "tibco.admin.monitormanage.uicomponents.page.deployment.ServiceUnitTabInterface";
//						headerClassName = "tibco.admin.monitormanage.uicomponents.page.deployment.ServiceUnitHeaderInterface";
						this.serviceUnitId = parameterArray.serviceUnitId;
						this.currentlyDisplayedScreen = this.serviceUnitScreen;
						this.callGetServiceUnits(true);
					}
					else if(screenIdVal == plugin.environmentScreenId)
					{
						tabClassName = "tibco.admin.monitormanage.uicomponents.page.deployment.EnvironmentTabInterface";
						headerClassName = "tibco.admin.monitormanage.uicomponents.page.deployment.EnvironmentHeaderInterface";
						if(parameterArray)
						{ 
							message.environmentId = parameterArray.environmentId;
							idForPluginClass = parameterArray.environmentId; 
						}
						this.currentlyDisplayedScreen = this.envScreen;
					}
					// notify the components that they need to display 
					tibco.admin.monitormanage.general.PageBusUtils.publish(tibco.admin.monitormanage.general.NavigationHandler.mainPageDisplayTopic, message);

					// only update the plugin components if it is not the Service Unit screen...the plugins will be loaded in
					// the "ongetServiceUnitsSuccess" method for the Service Unit screen
					if(!isServiceUnitScreen)
					{					
						// notify the plugin components that they need to display
						var iter = this.getPluginList().iterator();
	    	           	while(iter.hasNext()) {
	        	       	    var obj = iter.next();
	        	       	    if(jsx3.Class.forName(headerClassName).isInstance(obj) || jsx3.Class.forName(tabClassName).isInstance(obj))
	                	    { obj.updateComponent(idForPluginClass); }
	                	}
	                }
				
					this.currentlyDisplayedScreen.setDisplay(jsx3.gui.Block.DISPLAYBLOCK);
		        	this.block.repaint();
		        }
		        else
		        {
		        	this.displayScreenWaiting = true;
		        	this.screenIdWaiting = screenIdVal;
		        	this.parameterArrayWaiting = parameterArray;
		        }
        	}
        	
        	plugin.prototype.mainPageTabSelected = function() {
        		/*
        		// the main page tab was selected...make sure we go to the environment screen
        		if(this.envScreen.getDisplay() == jsx3.gui.Block.DISPLAYNONE)
        		{
        			this.currentlyDisplayedScreen.setDisplay(jsx3.gui.Block.DISPLAYNONE);
        			this.currentlyDisplayedScreen = this.envScreen;
        			this.envScreen.setDisplay(jsx3.gui.Block.DISPLAYBLOCK);
        			this.block.repaint();
        		}
        		*/
        	}
        	
        	plugin.prototype.refreshServiceAssemblyCache = function(subject, message, deploymentObj) {
        		deploymentObj.callGetServiceAssemblies();
        	}
        	
        	//call this method to begin the service call (eg.service.callgetServiceAssemblies();)
    		plugin.prototype.callGetServiceAssemblies = function() {
				
				if (tibco.admin.Main.getServer().getEnv("MODE")) {
                    // mode is live
                    var objService = tibco.admin.Main.loadService(this.getNamespace(), "tibco/admin/monitormanage/uicomponents/page/deployment/rules/serviceAssemblyRules.xml", "getServiceAssemblies");
                    objService.setEndpointURL(plugin.wsEndpointURL);
		    		// this setInboundURL should not be required...only here because of a current AMX framework bug
		    		objService.setInboundURL("tibco/admin/monitormanage/uicomponents/page/deployment/data/serviceAssemblyData.xml");
                }
                else {
                    var objService = new jsx3.net.Service(tibco.admin.Main.resolveURI(this.getNamespace(), "tibco/admin/monitormanage/uicomponents/page/deployment/rules/serviceAssemblyRules.xml"), "getServiceAssemblies", null, null);
                    // mode is static
                    objService.setInboundURL(tibco.admin.Main.resolveURI(this.getNamespace(), "tibco/admin/monitormanage/uicomponents/page/deployment/data/serviceAssemblyData.xml"));
                }
                
                objService.serviceAssemblyId = this.serviceAssemblyId;
                
                // initialize the list of metrics we wish to retrieve data for
				var metricsList = new jsx3.util.List();
				metricsList.add("description");
				metricsList.add("dateDeployed");
				metricsList.add("deployedBy");
				metricsList.add("status");
				metricsList.add("deployability");
				metricsList.add("numServiceUnits");
				metricsList.add("environmentName");
				metricsList.add("environmentKey");
				objService.metricsList = metricsList;

      			//subscribe and call
      			objService.subscribe(jsx3.net.Service.ON_SUCCESS, this.ongetServiceAssembliesSuccess);
      			objService.subscribe(jsx3.net.Service.ON_ERROR, this.ongetServiceAssembliesError);
      			objService.subscribe(jsx3.net.Service.ON_INVALID, this.ongetServiceAssembliesInvalid);
      			objService.doCall();
    		};

    		plugin.prototype.ongetServiceAssembliesSuccess = function(objEvent) {
      			//var responseXML = objEvent.target.getInboundDocument();
      			//jsx3.log("Success","The service call was successful.");
      			var message = { initialized:true };
        		tibco.admin.monitormanage.general.PageBusUtils.publish(plugin.serviceAssemblyInfoCacheSubject, message);
    		};

    		plugin.prototype.ongetServiceAssembliesError = function(objEvent) {
      			var myStatus = objEvent.target.getRequest().getStatus();
      			jsx3.log("Error","The service call failed. The HTTP Status code is: " + myStatus);
    		};

    		plugin.prototype.ongetServiceAssembliesInvalid = function(objEvent) {
      			jsx3.log("Invalid","The following message node just failed validation:\n\n" + objEvent.message);
    		};
    		
    		//call this method to begin the service call (eg.service.callgetServiceUnits();)
    		plugin.prototype.callGetServiceUnits = function(updatePlugins) {
    			var dataPath = "tibco/admin/monitormanage/uicomponents/page/deployment/data/serviceUnitData.xml";
    			var rulesPath = "tibco/admin/monitormanage/uicomponents/page/deployment/rules/serviceUnitRules.xml";
    			if (tibco.admin.Main.getServer().getEnv("MODE")) {
                    // mode is live
                    var objService = tibco.admin.Main.loadService(this.getNamespace(), rulesPath, "getServiceUnits");
                    objService.setEndpointURL(plugin.wsEndpointURL);
		    		// this setInboundURL should not be required...only here because of a current AMX framework bug
		    		objService.setInboundURL(dataPath);
                }
                else {
                    var objService = new jsx3.net.Service(tibco.admin.Main.resolveURI(this.getNamespace(), rulesPath), "getServiceUnits", null, null);
                    // mode is static
                    objService.setInboundURL(tibco.admin.Main.resolveURI(this.getNamespace(), dataPath));
                }
                
                objService.serviceUnitId = this.serviceUnitId;
                objService.deploymentViewObj = this;
                objService.updatePlugins = updatePlugins;
                
                // initialize the list of metrics we wish to retrieve data for
				var metricsList = new jsx3.util.List();
				metricsList.add("type");
				metricsList.add("version");
				metricsList.add("environmentName");
				metricsList.add("environmentKey");
				metricsList.add("serviceAssemblyName");
				metricsList.add("serviceAssemblyKey");
				objService.metricsList = metricsList;

      			//subscribe and call
      			objService.subscribe(jsx3.net.Service.ON_SUCCESS, this.ongetServiceUnitsSuccess);
      			objService.subscribe(jsx3.net.Service.ON_ERROR, this.ongetServiceUnitsError);
      			objService.subscribe(jsx3.net.Service.ON_INVALID, this.ongetServiceUnitsInvalid);
      			objService.doCall();
    		};

    		plugin.prototype.ongetServiceUnitsSuccess = function(objEvent) {
      			//var responseXML = objEvent.target.getInboundDocument();
      			//jsx3.log("Success","The service call was successful.");
      			
      			// initialize the service unit nodes cache
      			var serviceUnitNodesDoc = jsx3.xml.CDF.Document.newDocument();
      			var serviceUnitDoc = tibco.admin.Main.getServer().Cache.getDocument(plugin.serviceUnitInfoCacheId);
      			var serviceUnitRecord = serviceUnitDoc.getFirstChild();
      			var childRecords = serviceUnitRecord.getChildNodes();
      			for(i = 0; i < childRecords.size(); i++)
      			{
      				var childRecord = childRecords.get(i);
      				if(childRecord.getAttribute("recordName") == "node")
      				{
      					var clonedRecord = childRecord.cloneNode();
      					serviceUnitNodesDoc.appendChild(clonedRecord);
      				}
      			}
      			tibco.admin.Main.getServer().Cache.setDocument(plugin.serviceUnitNodesCacheId, serviceUnitNodesDoc);
      			
      			var message = { initialized:true };
        		tibco.admin.monitormanage.general.PageBusUtils.publish(plugin.serviceUnitInfoCacheSubject, message);
        		
        		if(objEvent.target.updatePlugins)
        		{
        			// notify the plugin components that they need to display
        			var deploymentViewObj = objEvent.target.deploymentViewObj;
        			var type = serviceUnitRecord.getAttribute("type");
					var iter = deploymentViewObj.getPluginList().iterator();
					var headerClassName = "tibco.admin.monitormanage.uicomponents.page.deployment.ServiceUnitHeaderInterface";
					var tabClassName = "tibco.admin.monitormanage.uicomponents.page.deployment.ServiceUnitTabInterface";
	    	        while(iter.hasNext()) {
	        	        var obj = iter.next();
	        	        if(jsx3.Class.forName(headerClassName).isInstance(obj))
	        	        { obj.updateComponent(deploymentViewObj.serviceUnitId, type); }
	        	        else if(jsx3.Class.forName(tabClassName).isInstance(obj))
	                    { 
	                    	// check to see if the Service Unit tab plugin supports the Service Unit type specified.
	                    	// if it's not supported hide the component
	                    	var supportedTypes = obj.getSupportedTypes();
	                    	var displayStyle = jsx3.gui.Block.DISPLAYBLOCK;
	                    	if(!supportedTypes || supportedTypes.contains(type))
	                    	{ obj.updateComponent(deploymentViewObj.serviceUnitId, type); }
	                    	else
	                    	{ displayStyle = jsx3.gui.Block.DISPLAYNONE; }
	                    	var tabId = "serviceUnit" + "_tab_" + obj.getTabText();
	                    	var serviceUnitIdx = deploymentViewObj.serviceUnitTabKeys.indexOf(tabId);
	                    	var tabObj = deploymentViewObj.serviceUnitTabObjs.get(serviceUnitIdx);
	                    	tabObj.setDisplay(displayStyle, true);
	                    }
	                }
        		}
    		};

    		plugin.prototype.ongetServiceUnitsError = function(objEvent) {
      			var myStatus = objEvent.target.getRequest().getStatus();
      			jsx3.log("Error","The service call failed. The HTTP Status code is: " + myStatus);
    		};

    		plugin.prototype.ongetServiceUnitsInvalid = function(objEvent) {
      			jsx3.log("Invalid","The following message node just failed validation:\n\n" + objEvent.message);
    		};

        });